//Regular Expression Matching 
/*
#include <vector>
#include <time.h>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <iostream>
using namespace std;

bool isMatch(string s, string p) {
	if(s.length()==0){
		if(p.length()==0)
			return true;
		else if(p.length()>=2&&p[1]=='*'){
			return isMatch(s,p.substr(2,p.length()));
		}else
			return false;
	}else{
		if(p.length()==0)
			return false;
	}
	for(int i=0;i<p.length();i++){
		if(i+1<p.length()){
			if(p[i+1]!='*'){
				if(p[i]=='.'||s[0]==p[i]){
					return isMatch(s.substr(1,s.length()),p.substr(1,p.length()));
				}else{
					return false;
				}
			}else{
				if(s.length()==0)
					return true;
				if(p[i]=='.'||s[0]==p[i]){//
					if(isMatch(s,p.substr(2,p.length())))
						return true;
					else
						return isMatch(s.substr(1,s.length()),p); 
				}else
					return isMatch(s,p.substr(2,p.length()));
			}
		}else{
			if((p[i]=='.'||s[0]==p[i])&&s.length()==1)
				return true;
			else
				return false;
		}
	}
	return true;
}
int main(){
	string s,p;
	while(cin>>s&&cin>>p){
		cout<<s<<","<<p<<endl;
		//s=s.substr(1,s.length());
		cout<<isMatch(s,p)<<endl;
		cout<<"********"<<endl;
	}
	system("pause");
	return 0;
}

*/